package com.looookme.shaozhuo.keyevent;

import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.widget.Toast;

/**
 * Created by Shaozhuo on 2015/9/9.
 */
public class KeyCode_Volume extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if(keyCode == event.KEYCODE_VOLUME_UP){
            Toast.makeText(KeyCode_Volume.this, "音量增加", Toast.LENGTH_SHORT).show();
            return  false;
        }else if(keyCode == event.KEYCODE_VOLUME_DOWN){
            Toast.makeText(KeyCode_Volume.this, "音量减小", Toast.LENGTH_SHORT).show();
            return false;
        }
        return super.onKeyDown(keyCode, event);
    }
}
